﻿<%@ Import Namespace="System.Data.OleDb" %>

<script runat="server">
    Sub Page_Load()
        
        Dim dbconn, sql, dbcomm, dbread
        
        dbconn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;data source=" & Server.MapPath("ImagineCup.mdb"))
        dbconn.Open()
        sql = "SELECT * FROM People"
        dbcomm = New OleDbCommand(sql, dbconn)
        dbread = dbcomm.ExecuteReader()
        users.DataSource = dbread
        users.DataBind()
        dbread.Close()
        dbconn.Close()
        
    End Sub
</script>

<html>
<head>
<title>Database View</title>
</head>
<body>

<form id="Form1" runat="server">
<asp:Repeater id="users" runat="server">

<HeaderTemplate>
<table border="1" width="100%">
<tr>
<th>First Name</th>
<th>Surname</th>
<th>Phone Number</th>
<th>Address</th>
</tr>
</HeaderTemplate>

<ItemTemplate>
<tr>
<td><%#Container.DataItem("FirstName")%></td>
<td><%#Container.DataItem("Surname")%></td>
<td><%#Container.DataItem("Age")%></td>
<td><%#Container.DataItem("Location")%></td>
</tr>
</ItemTemplate>

<FooterTemplate>
</table>
</FooterTemplate>

</asp:Repeater>
</form>

</body>
</html> 